package graphic;

import javax.swing.*;
import java.awt.*;

/**
 * @program: javaLearn
 * @description:
 * @author: renhai
 * @Date ：2021/12/20 22:31
 **/
public class TextComponents extends JFrame {
    public TextComponents() {
        super("文本编辑和文本显示");
        this.setBounds(400, 400, 400, 400);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        this.setLayout(new FlowLayout(FlowLayout.LEFT));
        /**
         *  this. add(new JLabel("user"));
         *         this. add(new JTextField(20));
         *         this. add(new JLabel("password"));
         *         this. add(new JPasswordField(20));
         *         this. add(new JLabel("description"));
         *         this. add(new JTextArea("my information:",5,20));
         */
        this.add(new JLabel("user"));
        this.add(new JTextField(10));
        this.add(new JLabel("password"));
        this.add(new JPasswordField(10));
        this.add(new JLabel("description"));
        this.add(new JButton("button"));
        this.add(new JTextArea("my information:", 5, 20));
        this.add(new JCheckBox("复选框1"));
        this.add(new JCheckBox("复选框2"));
        this.add(new JCheckBox("复选框3"));
        JPanel p = new JPanel();
        this.add(p);
        p.add(new JRadioButton("单选框1"));
        p.add(new JRadioButton("单选框2"));
        p.add(new JComboBox());
        this.setVisible(true);

    }

    public static void main(String[] args) {
        new TextComponents();
    }
}
